class Ticket < ActiveRecord::Base
 
  belongs_to :user
  belongs_to :category
  belongs_to :platform  
  validates_presence_of :created_user_id, :assigned_user_id, :category_id, :platform_id, :short_description, :status, :priority
  
  def get_created_user_name
    user = User.find_by_id(created_user_id)  
    user.username
  end
  
  def get assigned_user_name
    user = User.find_by_id(assigned_user_id)  
    user.username    
  end
  
  def get_category_name
    category = Category.find_by_id(category_id)  
    category.name
  end
  
  def get_plattform_name
    platform = Plattform.find_by_id(platform_id)
    platform.name
  end
  
end
